Total Complexity | 7 |
Total Lines | 67 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; |
||
8 | |||
9 | @Entity() |
||
10 | export class Shooting { |
||
11 | @PrimaryGeneratedColumn('uuid') |
||
12 | private id: string; |
||
13 | |||
14 | @Column({ type: 'varchar', nullable: false }) |
||
15 | private name: string; |
||
16 | |||
17 | @Column({ type: 'date', nullable: false }) |
||
18 | private shootingDate: Date; |
||
19 | |||
20 | @Column({ type: 'date', nullable: false }) |
||
21 | private closingDate: Date; |
||
22 | |||
23 | @Column('enum', { enum: ShootingStatus, nullable: false, default: ShootingStatus.DISABLED }) |
||
24 | private status: ShootingStatus; |
||
25 | |||
26 | @ManyToOne(() => School, { nullable: false, onDelete: 'CASCADE' }) |
||
27 | private school: School; |
||
28 | |||
29 | constructor( |
||
30 | name: string, |
||
31 | shootingDate: Date, |
||
32 | closingDate: Date, |
||
33 | status: ShootingStatus, |
||
34 | school: School |
||
35 | ) { |
||
36 | this.name = name; |
||
37 | this.shootingDate = shootingDate; |
||
38 | this.closingDate = closingDate; |
||
39 | this.status = status; |
||
40 | this.school = school; |
||
41 | } |
||
42 | |||
43 | public getId(): string { |
||
44 | return this.id; |
||
45 | } |
||
46 | |||
47 | public getName(): string { |
||
48 | return this.name; |
||
49 | } |
||
50 | |||
51 | public getShootingDate(): Date { |
||
52 | return this.shootingDate; |
||
53 | } |
||
54 | |||
55 | public getClosingDate(): Date { |
||
56 | return this.closingDate; |
||
57 | } |
||
58 | |||
59 | public getSchool(): School { |
||
60 | return this.school; |
||
61 | } |
||
62 | |||
63 | public getStatus(): ShootingStatus { |
||
64 | return this.status; |
||
65 | } |
||
66 | |||
67 | public update( |
||
68 | name: string, |
||
69 | shootingDate: Date, |
||
70 | closingDate: Date, |
||
71 | ): void { |
||
72 | this.name = name; |
||
73 | this.shootingDate = shootingDate; |
||
74 | this.closingDate = closingDate; |
||
75 | } |
||
77 |